//
//  CoreEditComponent.h
//  mobile
//
//  Created by abc on 2018/4/2.
//  Copyright © 2018年 azazie. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <ReactiveObjC/ReactiveObjC.h>
#import "BaseTextField.h"

#define HEIGHT_OFFSET   26.f
#define PADDING_FOR_CLEAR   3.5f

NS_ASSUME_NONNULL_BEGIN

@interface CoreEditComponent : UIView
@property (nonatomic, assign, getter=isInvalid) BOOL invalid;
@property (nonatomic, assign, getter=isEditable) BOOL editable;
@property (nonatomic, strong) CoreInputBlock tapResponseBlock;
@property (nonatomic, strong) CoreVertifyBlock vertifyBlock;

@property (nonatomic, strong) RACSignal *contentChange;
#pragma mark - customization property
//setcolors
- (CoreEditComponent *(^)(UIColor *color))bgColor;
- (CoreEditComponent *(^)(UIColor *color))textColor;
- (CoreEditComponent *(^)(UIColor *color))textTintColor;
- (CoreEditComponent *(^)(UIColor *color))placeHolderColor;
- (CoreEditComponent *(^)(UIColor *color))errorBorderColor;
- (CoreEditComponent *(^)(UIColor *color))disabledBackgroundColor;
- (CoreEditComponent *(^)(UIColor *color))disabledPlaceHolderColor;
//set texts & font
- (CoreEditComponent *(^)(UIFont *font))editFont;
- (CoreEditComponent *(^)(UIFont *font))risedFont;
- (CoreEditComponent *(^)(NSString *text))text;
- (CoreEditComponent *(^)(NSString *text))placeHolderText;
//configure right view
- (CoreEditComponent *(^)(UIView *view))volatileView;
- (CoreEditComponent *(^)(CGSize size))volatileSize;
- (CoreEditComponent *(^)(BOOL rotateable))volatileRotateable;
- (CoreEditComponent *(^)(void(^action)(void)))volatileAction;
//reset layout
- (CoreEditComponent *(^)(CGFloat distance))padding_left;
- (CoreEditComponent *(^)(CGFloat distance))padding_right;
//set limit
- (CoreEditComponent *(^)(BOOL clearable))textCleaarAble;
- (CoreEditComponent *(^)(BOOL riseable))placeHolderRiseable;
- (CoreEditComponent *(^)(NSInteger number))maxInputLenght;

- (CoreEditComponent *(^)(BOOL isPassword))passwordInput;

- (CoreEditComponent *(^)(UIKeyboardType type))keyboardType;
- (CoreEditComponent *(^)(UIReturnKeyType type))returnkeyType;
- (CoreEditComponent *(^)(BOOL autoCorrection))autoCorrection;
- (CoreEditComponent *(^)(BOOL autoCapitalization))autoCapitalization;

- (CoreEditComponent *(^)(BOOL clearable))textFieldTouchAble;

#pragma mark - other functions
+ (CoreEditComponent *)defaultEditComponent;

- (NSString *)currentText;
@end

NS_ASSUME_NONNULL_END
